<?php

class PotherModel extends Model {

    function getFilename($filename) {
        $pos = strripos($filename, '.');
        if ($pos === false) {
            return $filename;
        } else {
            return substr($filename, 0, $pos);
        }
    }

    function getExtension($filename) {
        $pos = strripos($filename, '.');
        if ($pos === false) {
            return "";
        } else {
            return substr($filename,$pos);
        }
    }

	function insert($field){
	$insert_string = "'".$field['user']."','".$field['followed']."'";
	$insert_string2 = "'".$field['followed']."','".$field['user']."','".BASE_PATH."pother/index/".$field['user']."'";
	//echo 'insert into follow_user (IdUser,IdFollowed) values ('.$insert_string.')';
        //echo 'insert into notifikasi (jenis,p1,p2,url) values (0,'.$insert_string2.')';
	$this->query('insert into follow_user (IdUser,IdFollowed) values ('.$insert_string.')');
        $this->query('insert into notifikasi (jenis,p1,p2,url) values (0,'.$insert_string2.')');
    }

    function insertkomen($field){
        //do the query
        $insert_string = "'".$field['idpost']."','".$field['id_writer']."','".$field['isi']."'";
        $this->query('insert into komen_wall (Idpost,Id_writer,Isi) values ('.$insert_string.')');
    }

    function insertpost($field){
        //do the query
        $insert_string = "'".$field['idwall']."','".$field['id_writer']."','".$field['isi']."'";
        $this->query('insert into post_wall (Idwall,Id_writer,Isi) values ('.$insert_string.')');
    }
}